<div class="container" title="个人成绩录入">
<div class="form-group" style="margin-top: 20px"> 
	<form class="form-inline">
		<label>选择班级：</label><input id="xzbj"  class="form-control"/> 
		<label>选择学生:</label><input id="xzxs"  class="form-control" disabled="true"/>
		<button id="cxxx" type="button">查询</button>
	
	</form>
</div>
	<div id="div1" class="container" style="flex-grow: 1; display: none; ">
		<table id="mytable">
			<thead>
				<tr>
				<th width="300"  data-field='course.name'>课程</th>
				<th  width="200"  data-field='grade' formatter=" formatOper(val, row, index)">成绩</th>
				</tr>
			</thead>
		</table>
</div>
</div>
<script type="text/javascript">
		$(function(){
			$('#xzbj').combobox({
				url:'banji/list',
				valueField:'id',
				textField:'name',
				onchange:function(id){					
				var bjId = id;	
				$('#xzxs').combobox({
					url:'grade/getStu?bjId='+bjId,
					valueField:'id',
					textField:'name',
				});
				
				}
			});
		$('#cxxx').bind('click',function(){
		var stuId=$('#xzxs').combobox('getValue');
	    var bjId=$('#xzbj').combobox('getValue');
	    if(bjId==0||stuId==0){
			$('#div1').hide();
			return;
		}else{
			$('#div1').show();
			
	}
		$('#mytable').datagrid({
		    searchUrl:'',
			url: 'grade/getgrcj?stuId='+stuId,
			search: false,//是否显示表格搜索
			pagination:false,//取消分页
			buttons:[],
			columns:[
				[
				{title:'aa',field:'aa',checkbox:true},
		        {field:'course.name',title:'课程'},
		        {field:'grade',title:'成绩',formatter: function formatOper(val, row, index){ 
					if(row.grade==null){
					
					       row.grade=0;
						 	}
						 return '<input type="number" class="form-control" onchange="xg('+row.id+',value)" id="input" value="'+row.grade+'"/>';
				}}
		  		  ]
				],
		});
		});
		
		})
	function xg(id,grade){
		if(!(/^[0-9]\d*$/.test(grade))){
			bootbox.alert('提示','请输入正整数','info');
			return;
		};
	$.post('grade/xgcj1',{id:id,grade:grade},function(data){});
	}
	</script>